package cn.edu.zknu.mita.controller;

import cn.edu.zknu.mita.service.IFindMsgService;
import cn.edu.zknu.mita.service.IFindWallService;
import cn.edu.zknu.mita.service.INoticeService;
import cn.edu.zknu.mita.service.IThankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by iwlnner on 2020/3/20.
 */
@Controller
public class IndexController {

    @Autowired
    private IFindMsgService findMsgService;
    @Autowired
    private IFindWallService findWallService;
    @Autowired
    private INoticeService noticeService;
    @Autowired
    private IThankService thankService;

    @RequestMapping("/index")
    public String index(Model model){
        //System.out.println(findWallService.listWallMsg());
        model.addAttribute("walls",findWallService.listWallMsg());
        model.addAttribute("goodss",findMsgService.listIndexFindGoodsMsg());
        model.addAttribute("lostors",findMsgService.listIndexFindLostorMsg());
        model.addAttribute("notices",noticeService.listIndexNotice());
        model.addAttribute("thanks",thankService.listIndexThanks());
        return "index";
    }

    @RequestMapping("/loadConstant")
    public String loadConstant(){
        return "constant";
    }

    @RequestMapping("/findGoods")
    public String findGoods(){
        return "FindGoods";
    }

    @RequestMapping("/findPet")
    public String findPet(){
        return "FindPet";
    }

    @RequestMapping("/findShe")
    public String findShe(){
        return "FindShe";
    }

    @RequestMapping("/findLostor")
    public String findLostor(){
        return "FindLostor";
    }


}
